package servlet;

import java.io.IOException;

import java.io.PrintWriter;
import java.sql.Connection;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import util.DbUtil;

import dao.ListUserDao;

public class DeleteListUserServlet extends HttpServlet {
	
	DbUtil dbUtil=new DbUtil();

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		String id=String.valueOf(request.getParameter("id"));

		try{
			Connection con=null;
			con=dbUtil.getCon();
			ListUserDao listuserdao=new ListUserDao();
			listuserdao.delete(con, id);
		}catch(Exception e){
			e.printStackTrace();
		}
		response.sendRedirect("ListUserServlet");
	}

	
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		doGet(request,response);
	}

}
